import 'package:hotfil_pub_web/shared/http/http.dart';

class MeRes {
  int? countryCode;
  String? phone;
  String? name;
  String avatar;
  int? balance;
  int? availableBalance;
  int? lockBalance;
  int? pledge;
  int? unconfirmedAmount;
  String? inviteTokenUser;

  MeRes({
    this.countryCode = 0,
    this.phone = '',
    this.name = '',
    this.avatar = '',
    this.balance = 0,
    this.availableBalance = 0,
    this.lockBalance = 0,
    this.pledge = 0,
    this.unconfirmedAmount = 0,
    this.inviteTokenUser = '',
  });

  factory MeRes.fromJson(Map<String, dynamic> json) => MeRes(
        countryCode: json['countryCode'] as int?,
        phone: json['phone'] as String?,
        name: json['name'] as String?,
        avatar: json['avatar'] as String,
        balance: json['balance'] as int?,
        availableBalance: json['availableBalance'] as int?,
        lockBalance: json['lockBalance'] as int?,
        pledge: json['pledge'] as int?,
        unconfirmedAmount: json['unconfirmedAmount'] as int?,
        inviteTokenUser: json['inviteTokenUser'] as String?,
      );

  Map<String, dynamic> toJson() => {
        'countryCode': countryCode,
        'phone': phone,
        'name': name,
        'avatar': avatar,
        'balance': balance,
        'availableBalance': availableBalance,
        'lockBalance': lockBalance,
        'pledge': pledge,
        'unconfirmedAmount': unconfirmedAmount,
        'inviteTokenUser': inviteTokenUser,
      };
}

Future<MeRes> getUserInfoApi() async {
  var res = await Https().get('/users/me');
  return MeRes.fromJson(res);
}
